package com.example.month11.fragment1.fragment;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.fragment.app.DialogFragment;

import com.example.recyclerview01.R;

/**
 * @Author Tom
 * @Date 2023/11/17 15:57
 * 至少实现onCreateView或者 onCreateDialog方法。
 * onCreateView 表示以xl布局文件的形式，展示dialog
 * onCreateDialog 利用AlertDialog或者dialog创建。
 */
public class MyDialogFragment extends DialogFragment {

    @NonNull
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setTitle("提示");
        builder.setMessage("确定要退出吗");
        builder.setIcon(R.mipmap.ic_launcher);
        builder.setPositiveButton("ok", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {

            }
        });
        builder.setNegativeButton("Cancel", null);
        return builder.create();
    }

}
